package com.jcxh.sg_exam.utils;

import com.jcxh.sg_exam.pojo.Admin;

public class AdminThreadLocalUtil {

    private final static ThreadLocal<Admin> ADMINUSER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户
     *
     * @param admin
     */
    public static void setAdmin(Admin admin) {
        ADMINUSER_THREAD_LOCAL.set(admin);
    }

    /**
     * 获取用户
     */
    public static Admin getAdmin() {
        return ADMINUSER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户
     */
    public static void clear() {
        ADMINUSER_THREAD_LOCAL.remove();
    }
}